﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using BLL;
namespace QLCUAHANGQUANAO
{
    public partial class MainForm : Form
    {

        public MainForm()
        {
            InitializeComponent();

        }

        private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {

        }
        private void DisableMenu()
        {
            this.menuQuanLy.Enabled = false;
            this.menuThongKe.Enabled = false;
            this.menuTroGiup.Enabled = false;
            this.menuDangXuat.Enabled = false;
        }
        private void EnableMenu()
        {
            this.menuQuanLy.Enabled = true;
            this.menuThongKe.Enabled = true;
            this.menuTroGiup.Enabled = true;
            this.menuDangNhap.Enabled = false;
            this.menuDangXuat.Enabled = true;
        }
        public void DangNhapFormLoad()
        {
            DisableMenu();
            DangNhapForm dnf = new DangNhapForm();
            dnf.ShowDialog();
            if (dnf.dangnhap)
            {
                EnableMenu();
            }
        }
        private void MainForm_Load(object sender, EventArgs e)
        {
            DangNhapFormLoad();
        }

        private void menuDangNhap_Click(object sender, EventArgs e)
        {
            DangNhapFormLoad();
        }

        private void menuThoat_Click(object sender, EventArgs e)
        {
            if(MessageBox.Show("Bạn có chắc muốn thoát khỏi chương trình không?","Thông báo",MessageBoxButtons.YesNo)==DialogResult.Yes)
            {
                this.Close();
                Dispose();
            }
        }

        private void menuDangXuat_Click(object sender, EventArgs e)
        {
            DisableMenu();
            DangNhapFormLoad();
        }



    }
}
